#include <bits/stdc++.h>
using namespace std;
int main() {
  int s, a, b, x;
  cin >> s >> a >> b >> x;

  int k = x / (a + b);
  int yu = x % (a + b);
  int t = k * a + min(yu, a); //  超若a秒，则按照a秒计算
  cout << t * s;

  return 0;
}
